package com.example.design.singletonDemo;

public class Singleton5 {

    public Singleton5() {
    }


    //静态内部方式能够避免同步带来的效率问题和有能实现延迟加载
    public static Singleton5 getInstance() {
        return SingletonUtils.singleton5;
    }

    public static class SingletonUtils {
        private static Singleton5 singleton5 = new Singleton5();
    }

    public static void main(String[] args) {
        Singleton5 singleton5 = Singleton5.getInstance();
        Singleton5 singleton51 = Singleton5.getInstance();
        System.out.println(singleton5==singleton51);
    }
}
